<template>
  <div>
    <h1>管理员列表</h1>
    <el-upload action="http://dbyxs.icu:3020/upload/video" :file-list="fileList" @on-change="handleChange" :http-request="getFile">
      <el-button size="small" type="primary">上传</el-button>
    </el-upload>
    <el-button size="small" type="success" @click="upload">确认上传</el-button>
    <el-button type="primary" @click='getadd'>请求</el-button>
    <el-button type="primary" @click='getSum'>点击自组建</el-button>
    <Items ref="child"></Items>

  </div>
</template>
<script>
import Item from './item.vue'
import Items from './items.vue'
import mixin from './admin'
export default {
  components: {
    Items: Items
  },
  extends: Item,
  mixins: [mixin],
  data() {
    return {
      file: {},
      fileList: []
    }
  },
  created() {
    this.db = '223'
    console.log(this.db, 'mixin')
    setTimeout(() => {
      console.log(this.db, '我是Mixin修改后的')
    }, 1500)
  },
  methods: {
    getSum() {
      this.getParams(2)
      console.log(this.num)
      this.$refs.child.getparam('refs')
    },
    getFile(item) {
      console.log(item.file)
      this.file = item.file
    },
    upload() {
      const fd = new FormData()
      fd.append('file', this.file)
      const config = { headers: { 'Content-Type': 'multipart/form-data' }}
      this.$http.post('http://dbyxs.icu:3020/upload/video', fd, config
      ).then(response => {
        console.log(response)
        //  this.$message.success(response.retCode)
      })
    },
    handleChange() { },
    getadd() {
      const data = {
        userid: 1
      }
      this.$http.post('/order/add', data).then(res => {
        console.log(res)
      })
    }
  }

}
</script>
<style lang="less" scoped>
</style>
